<div class="content-wrapper">
    <?php
    $form = $this->form;
    $form->prepare();

    $form->get('integralTypeName')->setAttributes([
        'readonly' => true
    ]);
    ?>
    <?php echo $this->form()->openTag($form); ?>
    <section class="content-header">
        <?php echo $this->partial('layout/breadcrumb'); ?>

        <h1 class="pull-right" id="dbshop-menu-top">
            <a href="<?php echo $this->url('user-integral');?>" class="btn btn-default btn-sm"><i class="fa fa-arrow-left"></i> <?php echo $this->translate('返回客户组列表'); ?></a>
            <button type="submit" class="btn btn-primary btn-sm"><i class="fa fa-check"></i> <?php echo $this->translate('保存积分类型'); ?></button>
            <?php echo $this->HelpUrl('userIntegralType'); ?>
        </h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-md-12">
                <div class="box box-primary">
                    <div class="box-header with-border">
                        <h3 class="box-title"><?php echo $this->translate('编辑积分类型'); ?></h3>
                    </div>

                    <div class="box-body">
                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('积分类型名称'); ?><span class="must_add_value">*</span></label>
                            <div class="col-sm-6">
                                <?php echo $this->formElement($form->get('integralTypeName')); ?>
                                <?php echo $this->formElementErrors($form->get('integralTypeName'), ['class'=>'error-message']); ?>
                            </div>
                        </div>
                        <?php if($this->integralTypeInfo->getIntegralTypeId() == 1) { ?>
                            <div class="form-group">
                                <label class="col-sm-2 control-label"><?php echo $this->translate('积分换算比例'); ?><span class="must_add_value">*</span></label>
                                <div class="col-sm-2">
                                    <?php echo $this->formElement($form->get('integralCurrencyCon')); ?>
                                    <?php echo $this->formElementErrors($form->get('integralCurrencyCon'), ['class'=>'error-message']); ?>
                                </div>
                                <p class="form-control-static"><?php echo $this->translate('基础货币(每100积分可以抵多少元)'); ?></p>
                            </div>
                        <?php } ?>

                        <div class="form-group">
                            <label class="col-sm-2 control-label"><?php echo $this->translate('初始积分数'); ?><span class="must_add_value">*</span></label>
                            <div class="col-sm-2">
                                <?php echo $this->formElement($form->get('integralDefaultNum')); ?>
                                <?php echo $this->formElementErrors($form->get('integralDefaultNum'), ['class'=>'error-message']); ?>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </div>

    </section>
    <?php echo $this->form()->closeTag(); ?>

</div>
<script>
    $(document).ready(function() {
        $("#<?php echo $form->getName(); ?>").validate({
            rules: {
                userGroupName: {
                    required: true
                }
            },
            messages: {
                userGroupName: {
                    required: "<?php echo $this->translate('客户组名称不能为空!'); ?>"
                }
            }
        });
    });
</script>
